import { BasicColumn, FormSchema } from '@/components/Table';
import { useI18n } from '@/hooks/web/useI18n';

const { t } = useI18n();

// 账号列表表格列定义
export const columns: BasicColumn[] = [
  {
    title: t('sys.login.userName'),
    dataIndex: 'username',
    width: 120,
  },
  {
    title: t('sys.account.nickname'),
    dataIndex: 'nickname',
    width: 120,
  },
  {
    title: t('sys.account.email'),
    dataIndex: 'email',
    width: 150,
  },
  {
    title: t('sys.account.phone'),
    dataIndex: 'phone',
    width: 120,
  },
  {
    title: t('sys.account.columns.status'),
    dataIndex: 'status',
    width: 80,
    slots: {
      customRender: 'status',
    },
  },
  {
    title: t('sys.informaionMatchaing.columns.createTime'),
    dataIndex: 'createTime',
    width: 180,
  },
  {
    title: t('sys.configuration.action'),
    width: 180,
    dataIndex: 'operation',
  },
];

// 账号搜索表单配置
export const searchFormSchema: FormSchema[] = [
  {
    field: 'username',
    label: t('sys.login.userName'),
    component: 'Input',
    colProps: {
      xl: 8,
      xxl: 6,
    },
  },
  {
    field: 'nickname',
    label: t('sys.account.nickname'),
    component: 'Input',
    colProps: {
      xl: 8,
      xxl: 6,
    },
  },
  {
    field: 'status',
    label: t('sys.account.columns.status'),
    component: 'Select',
    componentProps: {
      options: [
        { label: t('sys.configuration.startUsing'), value: 1 },
        { label: t('sys.configuration.blockUp'), value: 0 },
      ],
    },
    colProps: {
      xl: 8,
      xxl: 6,
    },
  },
];

// 账号表单配置
export const accountFormSchema: FormSchema[] = [
  {
    field: 'username',
    label: t('sys.login.userName'),
    component: 'Input',
    required: true,
    ifShow: ({ values }) => !values.id,
  },
  {
    field: 'nickname',
    label: t('sys.account.nickname'),
    component: 'Input',
    required: true,
  },
  {
    field: 'password',
    label: t('sys.account.columns.password'),
    component: 'InputPassword',
    required: true,
    ifShow: ({ values }) => !values.id,
  },
  {
    field: 'phone',
    label: t('sys.account.phone'),
    component: 'Input',
    required: true,
  },
  {
    field: 'email',
    label: t('sys.account.email'),
    component: 'Input',
    rules: [
      {
        type: 'email',
        message: t('sys.api.emailRule'),
      },
    ],
  },
  {
    field: 'status',
    label: t('sys.account.columns.status'),
    component: 'RadioGroup',
    defaultValue: 1,
    componentProps: {
      options: [
        { label: t('sys.configuration.startUsing'), value: 1 },
        { label: t('sys.configuration.blockUp'), value: 0 },
      ],
    },
    required: true,
  },
];

// 审批记录表格列定义
export const approvalColumns: BasicColumn[] = [
  {
    title: t('sys.login.userName'),
    dataIndex: 'userName',
    width: 120,
  },
  {
    title: t('sys.account.columns.status'),
    dataIndex: 'checkedStatus',
    width: 80,
  },
  {
    title: t('sys.informaionMatchaing.columns.createTime'),
    dataIndex: 'createTime',
    width: 180,
  },
  {
    title: '申请原因',
    dataIndex: 'purpose',
    width: 150,
  },
  {
    title: '申请原因',
    dataIndex: 'purpose',
    width: 150,
  },
  {
    title: '总标注/已标注/已通过/已结算',
    dataIndex: 'refusalReasonnul',
    width: 150,
  },
  {
    title: t('sys.configuration.action'),
    width: 180,
    dataIndex: 'operation',
  },
];

// 打标记录表格列定义
export const markerRecordColumns: BasicColumn[] = [
  {
    title: t('sys.userlist.columns.name'),
    dataIndex: 'targetName',
    width: 150,
  },
  {
    title: t('sys.analysis.columnsOffline.DetailsID'),
    dataIndex: 'taskId',
    width: 150,
  },
  {
    title: t('sys.markerAccount.markerRecord.markerUser'),
    dataIndex: 'userName',
    width: 120,
  },
  {
    title: t('sys.markerAccount.markerRecord.markerTime'),
    dataIndex: 'markingTime',
    width: 180,
  },
  {
    title: t('sys.markerAccount.markerRecord.auditPersonName'),
    dataIndex: 'auditPersonName',
    width: 200,
  },
  {
    title: t('sys.markerAccount.markerRecord.auditTime'),
    dataIndex: 'auditTime',
    width: 200,
  },
  {
    title: t('sys.markerAccount.markerRecord.customerAuditStatus'),
    dataIndex: 'customerAuditStatus',
    width: 200,
  },
  {
    title: t('sys.markerAccount.markerRecord.markerContent'),
    dataIndex: 'markingContent',
    width: 200,
  },
];

// 结算记录表格列定义
export const settlementColumns: BasicColumn[] = [
  {
    title: t('sys.markerAccount.settlement.settlementUserName'),
    dataIndex: 'userName',
    width: 120,
  },
  {
    title: t('sys.markerAccount.settlement.amount'),
    dataIndex: 'settlementAmount',
    width: 120,
  },
  {
    title: t('sys.markerAccount.settlement.settleFlag'),
    dataIndex: 'settleFlag',
    width: 120,
  },
  {
    title: t('sys.markerAccount.settlement.settlementTime'),
    dataIndex: 'settlementTime',
    width: 180,
  },
  {
    title: t('sys.markerAccount.settlement.settlementFinishTime'),
    dataIndex: 'settlementFinishTime',
    width: 180,
  },
  {
    title: t('sys.markerAccount.settlement.settlementUser'),
    dataIndex: 'settlementUserName',
    width: 120,
  },
  {
    title: t('sys.device.columns.remck'),
    dataIndex: 'remark',
    width: 200,
  },
  {
    title: t('sys.configuration.action'),
    width: 180,
    dataIndex: 'operation',
  },
];

// 结算表单配置
export const settlementFormSchema: FormSchema[] = [
  {
    field: 'markerUserId',
    label: t('sys.markerAccount.settlement.markerUserId'),
    component: 'Input',
    required: true,
    show: false,
  },
  {
    field: 'markerUserName',
    label: t('sys.markerAccount.settlement.markerUser'),
    component: 'Input',
    componentProps: {
      disabled: true,
    },
    required: true,
  },
  {
    field: 'amount',
    label: t('sys.markerAccount.settlement.amount'),
    component: 'InputNumber',
    componentProps: {
      min: 0,
      precision: 2,
    },
    required: true,
  },
  {
    field: 'remark',
    label: t('sys.device.columns.remck'),
    component: 'InputTextArea',
  },
];
